const path = require('path');
const favicon = require('serve-favicon');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
/**
 *
 * @param app
 * @param express
 * 解析请求
 *
 */
module.exports = function (app, express) {
    // app.use(favicon(path.join(__dirname, '../public', 'favicon.ico')))  图标
    app.use(express.static(path.join(__dirname, '../public')))
    /*
     *
     * 解析各种类型的body需要寻找常见的插件,body-parse,multer(用来解析form-data)等
     *
     */
    app.use(bodyParser.json({limit: '50mb'}));
    app.use(bodyParser.urlencoded({limit: '50mb', extended: true, parameterLimit: 50000}));
    app.use(cookieParser('213klmkl45hjlk2j4hlo'))//cookie签名秘钥随便填
    app.set('trust proxy', function (ip) {
        if (ip === '127.0.0.1' || ip === '::ffff:127.0.0.1') return true; // trusted IPs
        else return false;
    });
}
